package cn.itcast.work;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 消费者2
 *
 * @author lee.siu.wah
 * @version 1.0
 * <p>File Created at 2020-11-24<p>
 */
@Component
public class Consumer2 {


    /**
     * 消息监听的方法
     * queuesToDeclare: 声明队列(如果队列不存在，就会创建队列)
     */
    @RabbitListener(queuesToDeclare = @Queue(name = "work-queue",  durable = "true"))
    public void handlerMessage(String msg){
        System.out.println("==消费2==接收到的消息: " + msg);
    }
}
